import 'package:flutter/material.dart';

class TitleTextContainer extends StatelessWidget {
  final String _title;
  final Widget child;

  TitleTextContainer(this._title, {this.child});

  @override
  Widget build(BuildContext context) {
    return Stack(alignment: AlignmentDirectional.center, children: [
      Positioned(
        top: 0,
        child: Text(
          "$_title",
          style: TextStyle(
              fontSize: 20, color: Colors.red, fontWeight: FontWeight.bold),
        ),
      ),
      Container(
        margin: EdgeInsets.only(bottom: 12.0, top: 12),
        decoration: BoxDecoration(border: Border.all(color: Colors.grey)),
        padding: EdgeInsets.all(12.0),
        alignment: Alignment.center,
        child: Column(
          children: [
            SizedBox(height: 8.0),
            child ?? Container(),
          ],
        ),
      ),
    ]);
  }
}
